package cn.com.ebidding.spc.controller;

import cn.com.ebidding.spc.common.CommonResult;
import cn.com.ebidding.spc.common.PaymentInfoVo;
import cn.com.ebidding.spc.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created on 2020/10/12.
 *
 * @author qiyang.
 * 描述：
 */
@RestController
@Slf4j
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/consumer/payment/get/feign/{id}")
    public String getPayment(@PathVariable("id") Long id) {
        log.info("进入订单服务接口，调用支付服务接口");

        CommonResult<PaymentInfoVo> result = paymentFeignService.getPaymentById(id);

        log.info("调用支付服务接口，获取到的数据 = {}", result);

        return result.getData().getSerial();
    }

}
